Skip to content

fix(awk): accept expressions as printf format string#829

Merged
chaliy merged 1 commit intomainfrom
fix/issue-810-awk-printf-expr
Mar 26, 2026
Merged

fix(awk): accept expressions as printf format string#829
chaliy merged 1 commit intomainfrom
fix/issue-810-awk-printf-expr

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 26, 2026

Summary

  • Allow awk printf to accept any expression as format string, not just string literals
  • printf substr($i,1,1) now works instead of erroring with "printf requires format string"
  • Changed Printf action to store format as AwkExpr, evaluated at runtime

Test plan

  • awk_printf_expression_format — printf with substr expression
  • awk_printf_string_literal — string literal format still works
  • Full test suite passes

Closes #810

Closes #810 — awk printf now accepts any expression as the format argument,
not just string literals. `printf substr($i,1,1)` now works.

Changed Printf action to store format as AwkExpr, evaluated at runtime.
@chaliy chaliy merged commit ccae9a0 into main Mar 26, 2026
18 of 23 checks passed
@chaliy chaliy deleted the fix/issue-810-awk-printf-expr branch March 26, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: awk printf rejects expression as format string

1 participant